Skip to content

chore: Migrate tooling to uv, prek, ruff and ty#309

Merged
zupo merged 1 commit into
mainfrom
chore/migrate-to-uv-prek-ruff-ty
Jun 9, 2026
Merged

chore: Migrate tooling to uv, prek, ruff and ty#309
zupo merged 1 commit into
mainfrom
chore/migrate-to-uv-prek-ruff-ty

Conversation

@zupo

@zupo zupo commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Replace poetry with uv, pre-commit with prek, black/flake8/isort/autoflake with ruff, and mypy/typecov with ty. Adopt the wider prek check suite (codespell, taplo, yamlfmt, shellcheck, actionlint, zizmor, detect-secrets, debug-statement and Nix checks) and fix the findings across the codebase.

Also:

  • pin openapi-core to <0.20: 0.23 removed SchemaPath.contents(), so a fresh resolution installed a release that is broken with this addon
  • replace the py310/ poetry lock with uv sync --resolution lowest-direct for exercising the oldest supported dependencies on Python 3.10
  • rewrite shell.nix as a tools-only nixpkgs 26.05 shell, with uv managing the Python interpreters; drop poetry2nix
  • move pytest/coverage config into pyproject.toml; drop the typecov badge
  • switch the release workflow to uv build/uv publish and gh release

@zupo zupo force-pushed the chore/migrate-to-uv-prek-ruff-ty branch 5 times, most recently from a0dd495 to e28255a Compare June 8, 2026 23:05
@zupo

zupo commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Tested on my Mac. @miketheman can you confirm it works for you too?

@zupo zupo force-pushed the chore/migrate-to-uv-prek-ruff-ty branch 6 times, most recently from 3618157 to 71f2e1b Compare June 9, 2026 10:03
@zupo zupo requested a review from miketheman June 9, 2026 10:06
@karantan

karantan commented Jun 9, 2026

Copy link
Copy Markdown

Tests and checks are passing on my mac. I freshly cloned the repo and checked out this branch.

@miketheman miketheman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff! I ran it both inside and outside of nix, hence the comments.

The nix-shell still doesn't express a git command, which the new logic for determining whether to run is now before the pre-commit check, so that fails make lint

make types fails for an odd reason - the ty executable cannot be found ? I spent some time trying to debug this on my own, but got a bit lost.

Comment thread .pre-commit-config.yaml Outdated
Comment thread uv.lock
Comment thread shell.nix
Comment thread pyproject.toml
Comment thread pyproject.toml Outdated
@zupo zupo force-pushed the chore/migrate-to-uv-prek-ruff-ty branch from 71f2e1b to 50aaa45 Compare June 9, 2026 13:14
@zupo

zupo commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

The nix-shell still doesn't express a git command, which the new logic for determining whether to run is now before the pre-commit check, so that fails make lint

Added.

make types fails for an odd reason - the ty executable cannot be found ? I spent some time trying to debug this on my own, but got a bit lost.

In nix-shell or outside?

@miketheman

Copy link
Copy Markdown
Collaborator

make types fails for an odd reason - the ty executable cannot be found ? I spent some time trying to debug this on my own, but got a bit lost.

In nix-shell or outside?

in nix-shell

@zupo

zupo commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

make types fails for an odd reason - the ty executable cannot be found ? I spent some time trying to debug this on my own, but got a bit lost.

In nix-shell or outside?

in nix-shell

I tried on three separate machine and CI, so it seems it's something one your machine that pollutes nix shell. Can you try nix-shell --pure, so that none of the globally installed stuff gets into the shell?

@zupo zupo force-pushed the chore/migrate-to-uv-prek-ruff-ty branch 2 times, most recently from eb1d6e2 to 1d08b38 Compare June 9, 2026 21:49
Replace poetry with uv, pre-commit with prek, black/flake8/isort/autoflake
with ruff, and mypy/typecov with ty. Adopt the wider prek check suite used
by sister projects (codespell, taplo, yamlfmt, shellcheck, actionlint,
zizmor, detect-secrets, debug-statement and Nix checks) and fix the findings
across the codebase.

Also:
- bump the supported Python range to 3.11-3.14 (drop 3.10); replace the
  py310/ poetry lock with a committed uv-oldest.lock (lowest-direct,
  regenerated via `make lock`) for the oldest-deps Python 3.11 CI job
- pin openapi-core to <0.20: 0.23 removed SchemaPath.contents(), so a fresh
  resolution installed a release that is broken with this addon
- rewrite shell.nix as a tools-only nixpkgs 26.05 shell that provides
  python311/python314; drop poetry2nix
- build with the uv_build backend; move pytest/coverage config into
  pyproject.toml; drop the typecov badge
- switch the release workflow to `uv build`/`uv publish` and `gh release`
@zupo zupo force-pushed the chore/migrate-to-uv-prek-ruff-ty branch from 1d08b38 to 01428ca Compare June 9, 2026 22:26
@zupo zupo merged commit a43117d into main Jun 9, 2026
3 checks passed
zupo pushed a commit that referenced this pull request Jun 11, 2026
- Installing `detect-secrets` on its own doesn't include the required `gibberish`
  dependency to run
  Refs: https://github.com/NixOS/nixpkgs/blob/bd0ff2d3eac24699c3664d5966b9ef36f388e2ca/pkgs/development/python-modules/detect-secrets/default.nix#L34
  Refs: https://github.com/Yelp/detect-secrets/blob/5e141933554a0b74e7341841f318be21e895339c/setup.py#L46-L48
- Running `prek -a` in a pure nix shell fails to download hooks from
  https://github.com/pre-commit/pre-commit-hooks due to missing
  certificate bundle

Refs: #309

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman mentioned this pull request Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants